package com.leet.code.simple_array;

/**
 * @description: 1385.两个数组间的距离值
 * @author: WYG
 * @time: 2021/1/3 14:50
 */

public class FindTheDistanceValue {

    //双重for循环遍历所有的元素进行比较即可
    public int findTheDistanceValue(int[] arr1, int[] arr2, int d) {
        int res = 0;
        for (int i = 0; i < arr1.length; i++) {
            boolean flag = true;
            for (int j = 0; j < arr2.length; j++) {
                if (Math.abs(arr1[i] - arr2[j]) <= d) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                res++;
            }
        }
        return res;
    }

}
